Listing 4 Creating a link between the tween track and the sound track
Track soundTrack;
long referenceIndex;
// retrieve the sound track from the movie
soundTrack = GetMovieIndTrackType (theMovie, 1,
AudioMediaCharacteristic,
movieTrackCharacteristic | movieTrackEnabledOnly);
// create a link between the tween track and the sound track --
// on return, referenceIndex contains the index of the link
err = AddTrackReference (soundTrack, t, kTrackModifierReference,
&referenceIndex);
Once you have linked the tween track to its receiving track, you must update the input map of the receiving track's media to indicate how the receiving track should interpret the data it receives from the tween track. To do this, you create a QT atom container and insert an atom of type kTrackModifierInput whose ID is the index returned by the AddTrackReference function. Then, you insert two atoms as children of the kTrackModifierInput atom:
Once you have created the appropriate atoms in the input map, you call SetMediaInputMap to assign the input map to the receiving track's media.
The code shown in Listing 5 creates an input map for the sound track of a movie. In this code, the tween media is linked to a sound track; the interpolated tween values are used to modify the sound track's volume.
| Previous | Chapter Contents | Chapter Top | Next |